<%@page import="db.dao.*"%>
<%@ page language="java" contentType="text/html;" import="java.util.*" pageEncoding="UTF-8" %>
<%
response.setContentType("text/html;charset=UTF-8");
request.setCharacterEncoding("UTF-8");
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE html>
<html lang="zh">

	<head>
		<meta charset="utf-8">
		<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
		<title>教务系统管理界面</title>
		<link href="css/jquery-accordion-menu.css" rel="stylesheet" type="text/css" />
		<link href="css/font-awesome.css" rel="stylesheet" type="text/css" />
		<link href="css/stm.css" rel="stylesheet" type="text/css"/>
		<link href='http://cdn.webfont.youziku.com/webfonts/nomal/104133/46121/59478b3cf629d81a84e7e13e.css' rel='stylesheet' type='text/css' />
		<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Open+Sans:400,700">
		<style type="text/css">
			* {
				box-sizing: border-box;
				-moz-box-sizing: border-box;
				-webkit-box-sizing: border-box;
			}
			
			body {
				background: #3b424d;
			}
			
			.content {
				width: 260px;
				margin: 20px auto;
			}
			
			.filterinput {
				background-color: rgba(249, 244, 244, 0);
				border-radius: 15px;
				width: 90%;
				height: 30px;
				border: thin solid #FFF;
				text-indent: 0.5em;
				font-weight: bold;
				color: #FFF;
			}
			
			#demo-list a {
				overflow: hidden;
				text-overflow: ellipsis;
				-o-text-overflow: ellipsis;
				white-space: nowrap;
				width: 100%;
			}
		</style>
		<script src="js/jquery-1.11.2.min.js" type="text/javascript"></script>
		<script src="js/jquery-accordion-menu.js" type="text/javascript"></script>
		<script type="text/javascript">
			$(function() {
				//顶部导航切换
				$("#demo-list li").click(function() {
					$("#demo-list li.active").removeClass("active")
					$(this).addClass("active");
				})
			})
		</script>
	</head>
	<body>
		<div class="content" style="float: left">
			<div id="jquery-accordion-menu" class="jquery-accordion-menu #313131" >
				<div class="jquery-accordion-menu-header" id="form"></div>
				<ul id="demo-list">
					<%
					String goURL = "";
					if (session.getAttribute("usertype").equals("学生")) {
						goURL = "student.jsp";
					}else if (session.getAttribute("usertype").equals("教师")) {
						goURL = "teacher.jsp";
					}else if (session.getAttribute("usertype").equals("管理")) {
						goURL = "manage.jsp";
					}
					%>
					<li class="active"><a href="<%=goURL %>"><i class="fa fa-home"></i>返回 </a></li>
				</ul>
				<div class="jquery-accordion-menu-footer">
					欢迎使用重庆理工大学教务系统
				</div>
			</div>
		</div>
		<div class="InfoDiv">
			<div title="查询结果" align="center">
				<form action="updateStuCourse.action">
					<table style="width:80%;color: whitesmoke;" align="center" name="stucourse">
						<tr style="width:100%">
							<td>课程编号</td>
							<td>课程名称</td>
							<td>学生编号</td>
							<td>学生名称</td>
							<td>输入成绩</td>
						</tr>
						<%
							StuCourseDAO scDao = new StuCourseDAO();
							StuCourse sc = new StuCourse();
							String tid = (String) session.getAttribute("username");
							List<StuCourse> scList = scDao.findByProperty("id.courseid", (String)session.getAttribute("cid"));
							Iterator<StuCourse> itr = scList.iterator();
							while(itr.hasNext()){
								sc = itr.next();
								if(sc.getTeaCourse().getTeacher().getTeaid().equals(tid)){%>
									<tr style="width:100%">
										<td><input style="width:15%;min-width:120px;display:block;border:1px,soild,white;background:none;" type="text" readonly="readonly" name="courseid" value="<%=sc.getId().getCourseid() %>"/></td>
										<td><input style="width:15%;min-width:120px;display:block;border:1px,soild,white;background:none;" type="text" readonly="readonly" value="<%=sc.getTeaCourse().getCoursename() %>"/></td>
										<td><input style="width:15%;min-width:120px;display:block;border:1px,soild,white;background:none;" type="text" readonly="readonly" name="stuid" value="<%=sc.getId().getStuid() %>"/></td>
										<td><input style="width:15%;min-width:120px;display:block;border:1px,soild,white;background:none;" type="text" readonly="readonly" value="<%=sc.getStudent().getStuname() %>"/></td>
										<td><input style="width:15%;min-width:120px;" type="text" value="" name="score"/></td>
									</tr>
						<%}} %>
					</table>
					<input type="submit" name="updateStuCourse" value="确定" style="width:50%">
				</form>
			</div>
		</div>
	</body>
</html>